package bufete;

import Asesor.Estudiantes_asesor;
import Cliente.NuevoCliente;
import callProcs.ProcsAlumno;
import callProcs.ProcsInsertar;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;

/**
 *
 * @author Jito
 */
public class Casos extends javax.swing.JFrame {
    ProcsInsertar VerCliente =new ProcsInsertar();
    String consulta = "WHERE concat(Nombre_cliente,' ', Apellido_cliente) LIKE '";
    ArrayList<DatosCliente> cliente = new ArrayList<DatosCliente>();
    String idCliente, usuario;
    String idAsunto[];
    java.sql.ResultSet rss,rss2;
    /** Creates new form Casos */
    public Casos() {
        initComponents();
        llenarComboboxAsunto();
        l_usuario.setText(usuario);
        
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        C_ClientePanel = new javax.swing.JPanel();
        C_Cliente = new javax.swing.JLabel();
        C_NombreClienteIngreso = new javax.swing.JComboBox();
        C_NombreCliente = new javax.swing.JLabel();
        C_DireccionCliente = new javax.swing.JLabel();
        LDireccion = new javax.swing.JLabel();
        C_TelefonoCliente = new javax.swing.JLabel();
        C_NuevoCliente = new javax.swing.JButton();
        l_Noid = new javax.swing.JLabel();
        LIdentificacion = new javax.swing.JLabel();
        C_T_BuscarClliente = new javax.swing.JTextField();
        Cseleccionar = new javax.swing.JButton();
        l_dpi = new javax.swing.JLabel();
        l_telefono = new javax.swing.JLabel();
        C_CasoPanel = new javax.swing.JPanel();
        C_tipoCaso = new javax.swing.JLabel();
        C_NoFolio = new javax.swing.JLabel();
        C_tipoCasoIng = new javax.swing.JComboBox();
        C_NoFolioIngreso = new javax.swing.JTextField();
        C_DescripcionCaso = new javax.swing.JLabel();
        C_ObservacionCaso = new javax.swing.JLabel();
        jScrollPane1 = new javax.swing.JScrollPane();
        C_DescripcionCasoIngreso = new javax.swing.JTextPane();
        jScrollPane2 = new javax.swing.JScrollPane();
        C_ObservacionesCasoIngreso = new javax.swing.JTextPane();
        C_AsuntoCaso = new javax.swing.JLabel();
        C_AsuntoCasoIngreso = new javax.swing.JComboBox();
        C_Caso = new javax.swing.JLabel();
        BagregarAsunto = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();
        CFechaDia = new javax.swing.JComboBox();
        jLabel2 = new javax.swing.JLabel();
        CFechaMes = new javax.swing.JComboBox();
        jLabel3 = new javax.swing.JLabel();
        CFechaAño = new javax.swing.JComboBox();
        jLabel4 = new javax.swing.JLabel();
        C_AceptarCaso = new javax.swing.JButton();
        jLabel5 = new javax.swing.JLabel();
        l_usuario = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(bufete.BufeteApp.class).getContext().getResourceMap(Casos.class);
        setTitle(resourceMap.getString("Form.title")); // NOI18N
        setName("Form"); // NOI18N

        C_ClientePanel.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        C_ClientePanel.setName("C_ClientePanel"); // NOI18N
        C_ClientePanel.setNextFocusableComponent(C_NombreClienteIngreso);

        C_Cliente.setFont(resourceMap.getFont("C_Cliente.font")); // NOI18N
        C_Cliente.setText(resourceMap.getString("C_Cliente.text")); // NOI18N
        C_Cliente.setName("C_Cliente"); // NOI18N

        C_NombreClienteIngreso.setEditable(true);
        C_NombreClienteIngreso.setName("C_NombreClienteIngreso"); // NOI18N
        C_NombreClienteIngreso.setNextFocusableComponent(C_NuevoCliente);
        C_NombreClienteIngreso.addItemListener(new java.awt.event.ItemListener() {
            public void itemStateChanged(java.awt.event.ItemEvent evt) {
                C_NombreClienteIngresoItemStateChanged(evt);
            }
        });
        C_NombreClienteIngreso.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                C_NombreClienteIngresoActionPerformed(evt);
            }
        });

        C_NombreCliente.setFont(resourceMap.getFont("C_NombreCliente.font")); // NOI18N
        C_NombreCliente.setText(resourceMap.getString("C_NombreCliente.text")); // NOI18N
        C_NombreCliente.setName("C_NombreCliente"); // NOI18N

        C_DireccionCliente.setFont(resourceMap.getFont("C_DireccionCliente.font")); // NOI18N
        C_DireccionCliente.setText(resourceMap.getString("C_DireccionCliente.text")); // NOI18N
        C_DireccionCliente.setName("C_DireccionCliente"); // NOI18N

        LDireccion.setText(resourceMap.getString("LDireccion.text")); // NOI18N
        LDireccion.setEnabled(false);
        LDireccion.setName("LDireccion"); // NOI18N

        C_TelefonoCliente.setFont(resourceMap.getFont("C_TelefonoCliente.font")); // NOI18N
        C_TelefonoCliente.setText(resourceMap.getString("C_TelefonoCliente.text")); // NOI18N
        C_TelefonoCliente.setName("C_TelefonoCliente"); // NOI18N

        C_NuevoCliente.setFont(resourceMap.getFont("C_NuevoCliente.font")); // NOI18N
        C_NuevoCliente.setIcon(resourceMap.getIcon("C_NuevoCliente.icon")); // NOI18N
        C_NuevoCliente.setText(resourceMap.getString("C_NuevoCliente.text")); // NOI18N
        C_NuevoCliente.setToolTipText(resourceMap.getString("C_NuevoCliente.toolTipText")); // NOI18N
        C_NuevoCliente.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        C_NuevoCliente.setName("C_NuevoCliente"); // NOI18N
        C_NuevoCliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                C_NuevoClienteActionPerformed(evt);
            }
        });

        l_Noid.setFont(resourceMap.getFont("l_Noid.font")); // NOI18N
        l_Noid.setText(resourceMap.getString("l_Noid.text")); // NOI18N
        l_Noid.setName("l_Noid"); // NOI18N

        LIdentificacion.setText(resourceMap.getString("LIdentificacion.text")); // NOI18N
        LIdentificacion.setEnabled(false);
        LIdentificacion.setName("LIdentificacion"); // NOI18N

        C_T_BuscarClliente.setText(resourceMap.getString("C_T_BuscarClliente.text")); // NOI18N
        C_T_BuscarClliente.setName("C_T_BuscarClliente"); // NOI18N
        C_T_BuscarClliente.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                C_T_BuscarCllienteActionPerformed(evt);
            }
        });
        C_T_BuscarClliente.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                C_T_BuscarCllienteKeyPressed(evt);
            }
        });

        Cseleccionar.setText(resourceMap.getString("Cseleccionar.text")); // NOI18N
        Cseleccionar.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        Cseleccionar.setName("Cseleccionar"); // NOI18N
        Cseleccionar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                CseleccionarActionPerformed(evt);
            }
        });

        l_dpi.setText(resourceMap.getString("l_dpi.text")); // NOI18N
        l_dpi.setName("l_dpi"); // NOI18N

        l_telefono.setText(resourceMap.getString("l_telefono.text")); // NOI18N
        l_telefono.setName("l_telefono"); // NOI18N

        javax.swing.GroupLayout C_ClientePanelLayout = new javax.swing.GroupLayout(C_ClientePanel);
        C_ClientePanel.setLayout(C_ClientePanelLayout);
        C_ClientePanelLayout.setHorizontalGroup(
            C_ClientePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(C_ClientePanelLayout.createSequentialGroup()
                .addGroup(C_ClientePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(C_ClientePanelLayout.createSequentialGroup()
                        .addGroup(C_ClientePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(C_ClientePanelLayout.createSequentialGroup()
                                .addContainerGap()
                                .addComponent(C_NombreCliente)
                                .addGap(28, 28, 28)
                                .addGroup(C_ClientePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(C_NombreClienteIngreso, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(C_T_BuscarClliente, javax.swing.GroupLayout.PREFERRED_SIZE, 711, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(Cseleccionar, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(C_ClientePanelLayout.createSequentialGroup()
                                .addGap(410, 410, 410)
                                .addComponent(C_Cliente)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 57, Short.MAX_VALUE)
                        .addComponent(C_NuevoCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(C_ClientePanelLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(l_Noid)
                        .addGroup(C_ClientePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(C_ClientePanelLayout.createSequentialGroup()
                                .addGap(20, 20, 20)
                                .addComponent(LIdentificacion, javax.swing.GroupLayout.PREFERRED_SIZE, 327, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(C_ClientePanelLayout.createSequentialGroup()
                                .addGap(55, 55, 55)
                                .addComponent(l_dpi))))
                    .addGroup(C_ClientePanelLayout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(C_ClientePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(C_DireccionCliente)
                            .addComponent(C_TelefonoCliente))
                        .addGap(20, 20, 20)
                        .addGroup(C_ClientePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(l_telefono)
                            .addComponent(LDireccion, javax.swing.GroupLayout.PREFERRED_SIZE, 327, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap())
        );
        C_ClientePanelLayout.setVerticalGroup(
            C_ClientePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(C_ClientePanelLayout.createSequentialGroup()
                .addGap(11, 11, 11)
                .addGroup(C_ClientePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(C_NuevoCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(C_ClientePanelLayout.createSequentialGroup()
                        .addComponent(C_Cliente)
                        .addGap(18, 18, 18)
                        .addGroup(C_ClientePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(C_T_BuscarClliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(C_NombreCliente))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(C_ClientePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(C_NombreClienteIngreso, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(Cseleccionar, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(18, 18, 18)
                        .addGroup(C_ClientePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(l_Noid)
                            .addComponent(LIdentificacion)
                            .addComponent(l_dpi))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(C_ClientePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(C_DireccionCliente)
                            .addComponent(LDireccion))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(C_ClientePanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(C_TelefonoCliente)
                            .addComponent(l_telefono))))
                .addGap(29, 29, 29))
        );

        C_CasoPanel.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        C_CasoPanel.setName("C_CasoPanel"); // NOI18N

        C_tipoCaso.setFont(resourceMap.getFont("C_tipoCaso.font")); // NOI18N
        C_tipoCaso.setText(resourceMap.getString("C_tipoCaso.text")); // NOI18N
        C_tipoCaso.setName("C_tipoCaso"); // NOI18N

        C_NoFolio.setFont(resourceMap.getFont("C_NoFolio.font")); // NOI18N
        C_NoFolio.setText(resourceMap.getString("C_NoFolio.text")); // NOI18N
        C_NoFolio.setName("C_NoFolio"); // NOI18N

        C_tipoCasoIng.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Penal", "Laboral", "Civil" }));
        C_tipoCasoIng.setName("C_tipoCasoIng"); // NOI18N

        C_NoFolioIngreso.setText(resourceMap.getString("C_NoFolioIngreso.text")); // NOI18N
        C_NoFolioIngreso.setName("C_NoFolioIngreso"); // NOI18N
        C_NoFolioIngreso.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyTyped(java.awt.event.KeyEvent evt) {
                C_NoFolioIngresoKeyTyped(evt);
            }
        });

        C_DescripcionCaso.setFont(resourceMap.getFont("C_DescripcionCaso.font")); // NOI18N
        C_DescripcionCaso.setText(resourceMap.getString("C_DescripcionCaso.text")); // NOI18N
        C_DescripcionCaso.setName("C_DescripcionCaso"); // NOI18N

        C_ObservacionCaso.setFont(resourceMap.getFont("C_ObservacionCaso.font")); // NOI18N
        C_ObservacionCaso.setText(resourceMap.getString("C_ObservacionCaso.text")); // NOI18N
        C_ObservacionCaso.setName("C_ObservacionCaso"); // NOI18N

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        C_DescripcionCasoIngreso.setName("C_DescripcionCasoIngreso"); // NOI18N
        jScrollPane1.setViewportView(C_DescripcionCasoIngreso);

        jScrollPane2.setName("jScrollPane2"); // NOI18N

        C_ObservacionesCasoIngreso.setName("C_ObservacionesCasoIngreso"); // NOI18N
        jScrollPane2.setViewportView(C_ObservacionesCasoIngreso);

        C_AsuntoCaso.setFont(resourceMap.getFont("C_AsuntoCaso.font")); // NOI18N
        C_AsuntoCaso.setText(resourceMap.getString("C_AsuntoCaso.text")); // NOI18N
        C_AsuntoCaso.setName("C_AsuntoCaso"); // NOI18N

        C_AsuntoCasoIngreso.setName("C_AsuntoCasoIngreso"); // NOI18N

        C_Caso.setFont(resourceMap.getFont("C_Caso.font")); // NOI18N
        C_Caso.setText(resourceMap.getString("C_Caso.text")); // NOI18N
        C_Caso.setName("C_Caso"); // NOI18N

        BagregarAsunto.setText(resourceMap.getString("BagregarAsunto.text")); // NOI18N
        BagregarAsunto.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        BagregarAsunto.setName("BagregarAsunto"); // NOI18N
        BagregarAsunto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BagregarAsuntoActionPerformed(evt);
            }
        });

        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N

        CFechaDia.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30" }));
        CFechaDia.setName("CFechaDia"); // NOI18N

        jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
        jLabel2.setName("jLabel2"); // NOI18N

        CFechaMes.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12" }));
        CFechaMes.setName("CFechaMes"); // NOI18N

        jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
        jLabel3.setName("jLabel3"); // NOI18N

        CFechaAño.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "1970", "1971", "1972", "1973", "1974", "1975", "1976", "1977", "1978", "1979", "1980", "1981", "1982", "1983", "1984", "1985", "1986", "1987", "1988", "1989", "1990", "1991", "1992", "1993", "1994", "1995", "1996", "1997", "1998", "1999", "2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010", "2011" }));
        CFechaAño.setName("CFechaAño"); // NOI18N

        jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N
        jLabel4.setName("jLabel4"); // NOI18N

        javax.swing.GroupLayout C_CasoPanelLayout = new javax.swing.GroupLayout(C_CasoPanel);
        C_CasoPanel.setLayout(C_CasoPanelLayout);
        C_CasoPanelLayout.setHorizontalGroup(
            C_CasoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(C_CasoPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(C_CasoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(C_CasoPanelLayout.createSequentialGroup()
                        .addGroup(C_CasoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(C_ObservacionCaso)
                            .addComponent(C_DescripcionCaso))
                        .addGap(18, 18, 18)
                        .addGroup(C_CasoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 888, Short.MAX_VALUE)
                            .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 888, Short.MAX_VALUE)))
                    .addGroup(C_CasoPanelLayout.createSequentialGroup()
                        .addGroup(C_CasoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, C_CasoPanelLayout.createSequentialGroup()
                                .addComponent(C_NoFolio)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(C_NoFolioIngreso, javax.swing.GroupLayout.PREFERRED_SIZE, 122, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, C_CasoPanelLayout.createSequentialGroup()
                                .addComponent(C_tipoCaso)
                                .addGap(18, 18, 18)
                                .addComponent(C_tipoCasoIng, javax.swing.GroupLayout.PREFERRED_SIZE, 287, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGroup(C_CasoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, C_CasoPanelLayout.createSequentialGroup()
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel4)
                                .addGap(18, 18, 18)
                                .addComponent(jLabel1)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(CFechaDia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(jLabel2)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(CFechaMes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(29, 29, 29)
                                .addComponent(jLabel3)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(CFechaAño, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(198, 198, 198))
                            .addGroup(C_CasoPanelLayout.createSequentialGroup()
                                .addGap(27, 27, 27)
                                .addComponent(C_AsuntoCaso, javax.swing.GroupLayout.PREFERRED_SIZE, 61, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(C_CasoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(C_Caso, javax.swing.GroupLayout.PREFERRED_SIZE, 129, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGroup(C_CasoPanelLayout.createSequentialGroup()
                                        .addComponent(C_AsuntoCasoIngreso, javax.swing.GroupLayout.PREFERRED_SIZE, 363, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(18, 18, 18)
                                        .addComponent(BagregarAsunto, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE)))))))
                .addContainerGap())
        );
        C_CasoPanelLayout.setVerticalGroup(
            C_CasoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(C_CasoPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(C_Caso, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(C_CasoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(C_tipoCaso)
                    .addComponent(C_tipoCasoIng, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(C_AsuntoCasoIngreso, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(C_AsuntoCaso)
                    .addComponent(BagregarAsunto, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(C_CasoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(C_NoFolio)
                    .addComponent(C_NoFolioIngreso, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1)
                    .addComponent(CFechaDia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2)
                    .addComponent(CFechaMes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3)
                    .addComponent(CFechaAño, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel4))
                .addGroup(C_CasoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(C_CasoPanelLayout.createSequentialGroup()
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(C_CasoPanelLayout.createSequentialGroup()
                        .addGap(33, 33, 33)
                        .addComponent(C_DescripcionCaso)))
                .addGap(11, 11, 11)
                .addGroup(C_CasoPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(C_ObservacionCaso)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(38, Short.MAX_VALUE))
        );

        C_AceptarCaso.setIcon(resourceMap.getIcon("C_AceptarCaso.icon")); // NOI18N
        C_AceptarCaso.setText(resourceMap.getString("C_AceptarCaso.text")); // NOI18N
        C_AceptarCaso.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED));
        C_AceptarCaso.setName("C_AceptarCaso"); // NOI18N
        C_AceptarCaso.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                C_AceptarCasoActionPerformed(evt);
            }
        });

        jLabel5.setName("jLabel5"); // NOI18N

        l_usuario.setText(resourceMap.getString("l_usuario.text")); // NOI18N
        l_usuario.setName("l_usuario"); // NOI18N

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 647, Short.MAX_VALUE)
                .addComponent(C_AceptarCaso, javax.swing.GroupLayout.PREFERRED_SIZE, 99, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(110, 110, 110))
            .addGroup(layout.createSequentialGroup()
                .addGap(20, 20, 20)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(l_usuario)
                    .addComponent(C_ClientePanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(C_CasoPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(l_usuario)
                .addGap(2, 2, 2)
                .addComponent(C_ClientePanel, javax.swing.GroupLayout.PREFERRED_SIZE, 217, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(C_CasoPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, 158, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(C_AceptarCaso, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(53, 53, 53))))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents
    
    
    private void llenarComboboxAsunto(){
        C_AsuntoCasoIngreso.removeAllItems();
         try {
            rss = VerCliente.VerAsuntosCaso();
            idAsunto = new String[200];
            int cont=0;
            while (rss.next()){
                idAsunto[cont] = rss.getObject("idAsunto").toString();
                cont++;
                C_AsuntoCasoIngreso.addItem(rss.getObject("NombreAsunto"));
            }
        } catch (SQLException ex) {
            Logger.getLogger(Casos.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    
    public void set_user(String user)
    {
        usuario = user;
    }
    
    public void llenarmanulComboBox(String dato){
        C_AsuntoCasoIngreso.addItem(dato);
    }
    
    private void C_AceptarCasoActionPerformed(java.awt.event.ActionEvent evt) {                                              
        // TODO add your handling code here:
        if((C_NombreClienteIngreso.getItemCount() == 0) &&
         (C_tipoCasoIng.getItemCount() == 0) &&
         (C_AsuntoCasoIngreso.getItemCount() == 0) &&
         (C_NoFolioIngreso.getText().isEmpty()) &&
         (C_DescripcionCasoIngreso.getText().isEmpty()) &&
         (C_ObservacionesCasoIngreso.getText().isEmpty()))
                {
                 JOptionPane.showMessageDialog(null,"  Debe ingresar todos los campos ");
                }
         else
        {
            ProcsInsertar inCaso = new ProcsInsertar();
            String idAsunto = String.valueOf(C_AsuntoCasoIngreso.getSelectedIndex() +1);
            String idTipo = String.valueOf(C_tipoCasoIng.getSelectedIndex() +1);
            String descripccion = C_DescripcionCasoIngreso.getText();
            String fechainicio = CFechaAño.getSelectedItem().toString()+"-"+CFechaMes.getSelectedItem().toString()+"-"+CFechaDia.getSelectedItem().toString();
            String nofolio = C_NoFolioIngreso.getText();
            String observaciones = C_ObservacionesCasoIngreso.getText();
            inCaso.insertarNuevoCaso(idAsunto,idTipo, cliente.get(C_NombreClienteIngreso.getSelectedIndex()).getid(),descripccion,fechainicio,nofolio,observaciones, usuario);
            JOptionPane.showMessageDialog(null, cliente.get(C_NombreClienteIngreso.getSelectedIndex()).getid());
            JOptionPane.showMessageDialog(null,"  Datos Guardados  ");            
                       
        }
        
         C_T_BuscarClliente.setText("");
        LDireccion.setText("");
        LIdentificacion.setText("");
        C_NoFolioIngreso.setText("");
        C_DescripcionCasoIngreso.setText("");
        C_ObservacionesCasoIngreso.setText("");
        C_NombreClienteIngreso.removeAllItems();
        l_telefono.setText("");
        cliente.clear();
                       
    }                                             

    private void C_NoFolioIngresoKeyTyped(java.awt.event.KeyEvent evt) {                                          
      char caracter = evt.getKeyChar();
        if(((Character.isDigit(caracter)== false && caracter!= evt.VK_BACK_SPACE)))
            {
                evt.consume();  
            }  
    }                                         

    private void C_T_BuscarCllienteKeyPressed(java.awt.event.KeyEvent evt) {                                              
        // TODO add your handling code here:
//        LTelefono.removeAllItems();
//        java.sql.ResultSet rs;
//        LTelefono.removeAllItems();
//        C_NombreClienteIngreso.removeAllItems();
//        
//        try {
//           rs= VerCliente.verdatosCliente(C_T_BuscarClliente.getText());
//            while (rs.next()){
//                C_NombreClienteIngreso.addItem(rs.getObject("nombre"));
//                
//                idCliente = rs.getObject("idCliente").toString();
//                if (rs.getObject("No_registro_cliente") != null)
//                LIdentificacion.setText(rs.getObject("No_registro_cliente").toString()+" "+rs.getObject("No_orden_cliente").toString());
//                if (rs.getObject("Dpi_cliente")!= null)
//                    LIdentificacion.setText(rs.getObject("Dpi_cliente").toString());
//                    LDireccion.setText(rs.getObject("Direccion_cliente").toString()+" Zona "+rs.getObject("Zona"));
//                    if (rs.getObject("Telefono")!= null) LTelefono.addItem(rs.getObject("Telefono").toString());
//            }
//        } catch (SQLException ex) {
//            Logger.getLogger(Estudiantes_asesor.class.getName()).log(Level.SEVERE, null, ex);
//        }
//        int par=0;
//        for (int i =0; i<C_NombreClienteIngreso.getItemCount(); i++){
//           par = i%2;
//            if (par != 0) C_NombreClienteIngreso.removeItemAt(i);
//        }
        
    }                                             

    private void C_NombreClienteIngresoActionPerformed(java.awt.event.ActionEvent evt) {                                                       
        // TODO add your handling code here:
       
        
        //C_T_BuscarClliente.setText(C_NombreClienteIngreso.getSelectedItem().toString());
       //  C_NombreClienteIngreso.removeAllItems();
    }                                                      

    private void CseleccionarActionPerformed(java.awt.event.ActionEvent evt) {                                             
        LIdentificacion.setText(cliente.get(C_NombreClienteIngreso.getSelectedIndex()).getCed());
        l_dpi.setText(cliente.get(C_NombreClienteIngreso.getSelectedIndex()).get_dpi());
        LDireccion.setText(cliente.get(C_NombreClienteIngreso.getSelectedIndex()).get_dir());
        l_telefono.setText(cliente.get(C_NombreClienteIngreso.getSelectedIndex()).get_tel() );
    }                                            

    private void C_NuevoClienteActionPerformed(java.awt.event.ActionEvent evt) {                                               
        // TODO add your handling code here:
//        NuevoCliente NC = new NuevoCliente();
//        NC.setVisible(true);
    }                                              

    private void BagregarAsuntoActionPerformed(java.awt.event.ActionEvent evt) {                                               
        // TODO add your handling code here:
        //NuevoAsunto Nasun = new NuevoAsunto();
        //Nasun.setVisible(true);
        String Asunto = JOptionPane.showInputDialog(null,"Ingrese Nuevo Asunto");
        ProcsAlumno mete = new ProcsAlumno();
        try {
            mete.MeteAsunto(Asunto, usuario);
            JOptionPane.showMessageDialog(null, "Asunto ingresado exitosamente");
            
        } catch (SQLException ex) {
            Logger.getLogger(Casos.class.getName()).log(Level.SEVERE, null, ex);
        }
        llenarComboboxAsunto();
    }                                              

    private void C_T_BuscarCllienteActionPerformed(java.awt.event.ActionEvent evt) {                                                   
        cliente.clear();
        java.sql.ResultSet rs;
         C_NombreClienteIngreso.removeAllItems();
        try {
            rs = VerCliente.VerdatosCliente(consulta+C_T_BuscarClliente.getText()+"'");
            int x = 1;
            while(rs.next()){
                C_NombreClienteIngreso.addItem(String.valueOf(x) + ". " + rs.getString("Nombre"));
                cliente.add(new DatosCliente(rs.getString("idCliente"), rs.getString("Nombre"), rs.getString("No. Cedula"), rs.getString("Dpi_Cliente"), rs.getString("Direccion"), rs.getString("Telefono")));
                x++;
            }
          
            
        } catch (SQLException ex) {
            Logger.getLogger(Casos.class.getName()).log(Level.SEVERE, null, ex);
        }
    }                                                  

    private void C_NombreClienteIngresoItemStateChanged(java.awt.event.ItemEvent evt) {                                                        
//        LIdentificacion.setText(cliente.get(C_NombreClienteIngreso.getSelectedIndex()).getCed());
             
    }                                                       

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new Casos().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton BagregarAsunto;
    private javax.swing.JComboBox CFechaAño;
    private javax.swing.JComboBox CFechaDia;
    private javax.swing.JComboBox CFechaMes;
    private javax.swing.JButton C_AceptarCaso;
    private javax.swing.JLabel C_AsuntoCaso;
    private javax.swing.JComboBox C_AsuntoCasoIngreso;
    private javax.swing.JLabel C_Caso;
    private javax.swing.JPanel C_CasoPanel;
    private javax.swing.JLabel C_Cliente;
    private javax.swing.JPanel C_ClientePanel;
    private javax.swing.JLabel C_DescripcionCaso;
    private javax.swing.JTextPane C_DescripcionCasoIngreso;
    private javax.swing.JLabel C_DireccionCliente;
    private javax.swing.JLabel C_NoFolio;
    private javax.swing.JTextField C_NoFolioIngreso;
    private javax.swing.JLabel C_NombreCliente;
    private javax.swing.JComboBox C_NombreClienteIngreso;
    private javax.swing.JButton C_NuevoCliente;
    private javax.swing.JLabel C_ObservacionCaso;
    private javax.swing.JTextPane C_ObservacionesCasoIngreso;
    private javax.swing.JTextField C_T_BuscarClliente;
    private javax.swing.JLabel C_TelefonoCliente;
    private javax.swing.JLabel C_tipoCaso;
    private javax.swing.JComboBox C_tipoCasoIng;
    private javax.swing.JButton Cseleccionar;
    private javax.swing.JLabel LDireccion;
    private javax.swing.JLabel LIdentificacion;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JLabel l_Noid;
    private javax.swing.JLabel l_dpi;
    private javax.swing.JLabel l_telefono;
    private javax.swing.JLabel l_usuario;
    // End of variables declaration//GEN-END:variables
}
